package com.example.webpractice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.webpractice.po.ConfigPO;
import com.example.webpractice.service.ConfigService;
import com.example.webpractice.utils.ServerResponseEntity;
import com.example.webpractice.vo.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录相关
 */
@RequestMapping("config")
@RestController
public class ConfigController {

    @Autowired
    private ConfigService configService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    public ServerResponseEntity page() {
        PageVo page = configService.queryAll(null);
        return ServerResponseEntity.success(page);
    }

    /**
     * 根据name获取信息
     */
    @RequestMapping("/info")
    public ServerResponseEntity infoByName(@RequestParam String name) {
        ConfigPO config = configService.selectOne(new QueryWrapper<ConfigPO>().eq("name", "faceFile"));
        return ServerResponseEntity.success(config);
    }
}
